/**
 * 列表适配通用逻辑及组件
*/
import tableOperateBtn from '@/components/Common/tableOperateBtn';
import MoreOpeator from '@/components/Common/baseComponent/moreOpeator';
import operateBtns from '@/assets/mobileIcon/operateBtns.png';
import { mapState } from 'vuex';
export default {
  components: {
    tableOperateBtn,
    MoreOpeator
  },
  data() {
    return {
      operateBtns
    };
  },
  computed: {
    ...mapState({
      'showMobilePage': state => state.app.showMobilePage
    }),
    pageLayout() {
      return 'total, prev, next, jumper';
    },
    operateWidth() { // 操作列宽度
      return this.showMobilePage ? 50 : 110;
    },
    selectFixed() { // 勾选列浮动
      return this.showMobilePage ? false : 'left';
    },
    operateAlign() {
      return this.showMobilePage ? 'center' : 'left';
    },
    operateFix() {
      return 'right';
    },
    useFixed() { // 是否固定列
      return !this.showMobilePage;
    }
  },
  methods: {
    // 审批单号缩写
    handleSnNumber(numStr = '') {
      if (!this.showMobilePage) return numStr;
      if (!numStr) return '';
      return numStr.substring(0, 2) + '...' + numStr.substring(numStr.length - 4, numStr.length);
    },
    // 单独设置某一列宽度
    handleTdWidth(mobileWidth = 100, PcWidth = 150) {
      return this.showMobilePage ? mobileWidth : PcWidth;
    },
    rowHeight(pcHeight = 49) { // 行高度
      return this.showMobilePage ? 40 : pcHeight;
    }
  }
};
